<template>
  <nav>
    <!-- <button @click="linkTo('/child01/test/home')">Home1</button>
    <button @click="linkTo('/child01/test/test')">About111</button> -->
    <button type="button" @click="doFn">切换 siderbar</button>
    <button type="button" @click="doFn2('/child01/home')">切换路由</button>
    <button type="button" @click="doFn2('/child01/test')">切换路由</button>
    <!-- <router-link to="/">Home</router-link> |
    <router-link to="/about">About</router-link> -->
  </nav>
  <router-view/>
</template>

<script setup>
import actions from '@/qiankun/actions'

const linkTo = (path) => {
  actions.parentRouter.push({
    path,
    query: {
      name: "吴久",
      age: 122
    }
  })
}

const doFn = () => {
  console.log(actions.parentStore)
  // actions.setGlobalState({open: false})
}

const doFn2 = (path) => {
  actions.parentRouter.push(path)
}
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
